<template>
    <div class="card">
        <!-- {{this.cardData}} -->
        <div class="block">
            <div v-if="this.cardData == ''" class="noEquipment"> 
                该项绑定设备未开启
            </div>
            <el-carousel trigger="click" class="card_hight" :autoplay="false" :initial-index="cardData.index" >
            <el-carousel-item v-for="item in cardData.unit" :key="item.index">
                <!-- 设备标题 -->
                <router-link to="/overview">
                    <h4 class="normal" @click="router('airlite',item)" :title="item.name">
                    <!-- <svg class="icon card_icon" aria-hidden="true">
                        <use xlink:href="#icon-xinfeng-copy"></use>
                    </svg> -->
                    <img class="title_icon" src="../../assets/title.png" alt />
                    {{item.typename}}:&nbsp;{{item.name}}
                 </h4>
                </router-link>
                <!-- 卡片内容 -->
                <div class="card_padding">
                    <div class="card_padding_flex">
                       <div class="card-jjj card_airlite_bk" style="margin-top:0px">
                            <span class="card-jjj_fs">{{item.unit[3].value.toFixed(1)}}</span>
                            <span class="card-jjj_fl">{{item.unit[3].flag}}</span>
                            <p>{{item.unit[3].name}}</p>
                        </div>
                        <div class="card-jjj" style="margin-top:0px">
                            <span v-if="item.unit[0].value == 0">关机</span>
                            <span v-if="item.unit[0].value == 1">自动</span>
                            <span v-if="item.unit[0].value == 2">开机</span>
                            <span v-if="item.unit[0].value == 3">定时</span>
                            <p>工作模式</p>
                        </div>
                        <div class="card-jjj card_airlite_bk">
                            <span class="card-jjj_fs">{{item.unit[2].value.toFixed(0)}}</span>
                            <span class="card-jjj_fl">{{item.unit[2].flag}}</span>
                            <p>{{item.unit[2].name}}</p>
                        </div>
                        <div class="card-jjj">
                            <span v-if="item.unit[1].value == 0">停止</span>
                            <span v-if="item.unit[1].value == 1">低速</span>
                            <span v-if="item.unit[1].value == 2">中速</span>
                            <span v-if="item.unit[1].value == 3">高速</span>
                            <p>当前风速</p>
                        </div>
                    </div>
                </div>
                 
            </el-carousel-item>
            </el-carousel>
        </div>
        
    </div>
</template>

<script>
export default {
    props: ['nowIndex', 'cardData', 'nowId'],
    data () {
        return{
        }
    },
    created() {
    },
    methods: {
        // 跳转
        router(val,item){
            var arr = {
                addr:item.addr,
                name:item.name,
                type:item.type,
                uid:item.uid
            }
            localStorage.setItem("当前设备编号", JSON.stringify(arr))
            localStorage.setItem("menuRouter", val)
        },
    },
     // 清除定时器
    beforeDestroy() {
    },
}
</script>

<style scoped>

/deep/ .el-carousel__container .el-carousel__arrow {
    height: 150px !important;
    width: 110px !important;
    border-radius: 0;
    background: none;
}
/deep/ .el-icon-arrow-left {
    margin-left: -110px !important;
}
/deep/ .el-icon-arrow-right{
    margin-right: -110px !important;
}
/deep/ .el-carousel__indicators{
    display: none;
}
.card_padding .item{
    width: 100%;
    height: 25px;
    float: left;
    /* text-align: center; */
    font-size: 18px;
    margin: 12px 0;
}
.normal .card_icon{
    font-size: 20px;
}
/deep/ .card_padding {
    padding: 0px 20px 0px 30px !important;
}
.card_padding_flex{
    display: flex;
    flex-wrap:wrap;
    justify-content: center;
    align-items: center;
    margin-top: 25px;
}
.card-jjj{
        width: 50%;
        /* float: left; */
        text-align: center;
        margin: 16px 0px;
        margin-bottom: 10px;
        padding-bottom: 6px;
    }
    .card-jjj span{
        font-size: 25px;
        line-height: 50px;
        color: #facd86;
    }
     /* .card-jjj span f{
        font-size: 20px;
        font-weight: normal;
 } */
 .card-jjj_fs{
     color: #38bdea !important;
     font-size: 35px !important;
     font-weight: normal !important;
 }
 .card-jjj_fl{
     color: #fff !important;
     font-weight: normal !important;
     font-size: 16px !important;
 }
 .card_airlite_bk{
     width: 50%;
     border-left: 4px solid #8fbbff;
     border-right: 4px solid #8fbbff;
     background: #6e7c9b42;
 }
</style>